/*
 * @Author: gyc
 * @Date: 2020-04-20 12:48:58
 * @LastEditTime: 2020-08-21 08:42:13
 * @Description: 测试版
 */
const webpack = require('webpack')
module.exports = {
    loading: false,
    head: {
        title: '无名小站',
        meta: [{
                charset: 'utf-8'
            },
            {
                name: 'viewport',
                content: 'width=device-width, initial-scale=1'
            },
            {
                hid: 'description',
                name: 'description',
                content: 'Nuxt.js project'
            }
        ],
        link: [{
                rel: 'icon',
                type: 'image/x-icon',
                href: '/img/logo.png'
            },
            // {
            //     rel: 'stylesheet',
            //     type: 'text/css',
            //     href: 'http://unpkg.com/view-design/dist/styles/iview.css'
            // }
        ],
        // script: [{
        //     type: "text/javascript",
        //     src: 'http://vuejs.org/js/vue.min.js'
        // }, {
        //     type: "text/javascript",
        //     src: 'http://unpkg.com/view-design/dist/iview.min.js'
        // }],
        htmlAttrs: { //中文版页面
            lang: 'zh-cn',
            amp: true
        }
    },
    build: {
        //引入Jquery
        plugins: [
            new webpack.ProvidePlugin({
                '$': 'jquery'
            })
        ],
        //less配置
        loaders: {
            less: {
                lessOptions: {
                    javascriptEnabled: true,
                }
            }
        },
        //加载媒体资源
        extend(config, ctx) {
            config.module.rules.push({
                test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
                loader: 'file-loader',
            });
        }
        //px2rem
        // postcss: [
        //     require('postcss-px2rem')({
        //         remUnit: 16
        //     })
        // ],
        // transpile: ['axios-loading']
    },
    //插件加载
    plugins: [{
            src: '~plugins/iview',
            ssr: true
        }, {
            src: '~plugins/axios-loading',
            ssr: false
        }, {
            src: '~plugins/utils',
            ssr: false
        },
        {
            src: '~plugins/swiper',
            ssr: false
        },
        {
            src: '~plugins/mavonEditor',
            ssr: false
        },
        {
            src: '~plugins/axios',
            ssr: true
        },
        {
            src: '~plugins/nuxt-quill-plugin.js',
            ssr: false //仅在客户端渲染
        },
        '~plugins/auth',
        // '~plugins/axios-loading'
    ],
    modules: [
        ['@nuxtjs/axios'],
        //全局引入SCSS变量
        '@nuxtjs/style-resources',
        // ['@nuxtjs/pwa']
        // 'nuxt-sass-resources-loader'
    ],
    styleResources: {
        scss: '~/assets/css/main.scss'
    },
    axios: {
        // proxy: true,
        // credentials: true
    },
    proxy: {
        // '/api': {
        //     target: 'http://localhost:7001', // 代理地址
        //     changeOrigin: true, // 表示是否跨域
        //     // pathRewrite: { '^/api': '/' } //api替换/
        // },
    },
    //加载全局页面过渡特效
    css: [
        'assets/css/main.css',
        // {src: 'assets/css/main.scss', lang: 'scss'} // 指定
    ],
    server: {
        port: 3000, // default: 3000
        host: '0.0.0.0' // default: localhost
    },
    render: {
        resourceHints: false
    },
}